package com.zgm.ch04._2_1_4;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.Assert;

public class SoutSimpleBean extends SimpleBeanSupport {
	private String person;
	
	public static void main(String[] args){
		//可以
		BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("com/zgm/ch04/_2_1_4/_2_1_4-context.xml"));
		SoutSimpleBean soutSimpleBean = (SoutSimpleBean) beanFactory.getBean("soutSimpleBean");
//		System.out.println(simpleBean);
	}
	
	protected void initSimple() throws Exception{
		Assert.notNull(this.person, "person 的值必须设置！");
	}
	
	public String toString(){
		return String.format("%s says \"%s\"", this.person, super.getValue());
	}
	

	public final String getPerson() {
		return person;
	}

	public final void setPerson(String person) {
		this.person = person;
	}

}
